//**************************************************************************
// Copyright 2008 Peter Project (http://www.codeplex.com/peter)
//
// License : GNU General Public License (GPL)
// For full text of the license please goto:
// http://www.gnu.org/licenses/gpl-2.0.html
//
// This code is provided on an AS IS basis, with no WARRANTIES,
// CONDITIONS or GUARANTEES of any kind.
//
//		File: PeterInterfaces.cs
//		Purpose: This file holds all the Interfaces for the Peter
//				 Plugin Architecture.
//
//**************************************************************************

using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using PeterInterface;
using WeifenLuo.WinFormsUI.Docking;

namespace Peter
{
    public partial class FindResults : DockContent, IPeterPluginTab
    {
        private IPeterPluginHost m_Host;

        public FindResults()
        {
            InitializeComponent(); 
            System.Resources.ResourceManager mngr = new System.Resources.ResourceManager("Peter.InternalImages", this.GetType().Assembly);
            this.imgMain.Images.Add("Next", (Image)mngr.GetObject("Next"));
            this.TabText = "Find Results";
        }

        /// <summary>
        /// Gets or Sets the Tree View...
        /// </summary>
        public TreeView Tree
        {
            get { return this.treeMain; }

            set { this.treeMain = value; }
        }

        /// <summary>
        /// Gets or Sets the Image List...
        /// </summary>
        public ImageList Images
        {
            get { return this.imgMain; }

            set { this.imgMain = value; }
        }

        /// <summary>
        /// Overrides the Close Action...
        /// </summary>
        /// <param name="e">Cancel Events.</param>
        protected override void OnClosing(CancelEventArgs e)
        {
            e.Cancel = true;
            this.Hide();
            base.OnClosing(e);
        }

        #region IPeterPluginTab Members

        public void Save()
        {
        }

        public void SaveAs(string filePath)
        {
        }

        public void Cut()
        {
        }

        public void Copy()
        {
            if (this.treeMain.SelectedNode != null)
            {
                Clipboard.SetText(this.treeMain.SelectedNode.Text);
            }
        }

        public void Paste()
        {
        }

        public void Undo()
        {
        }

        public void Redo()
        {
        }

        public void Print()
        {
        }

        public void Duplicate()
        {
        }

        public void Delete()
        {
            if (this.treeMain.SelectedNode != null)
            {
                if (this.treeMain.SelectedNode.Parent == null)
                {
                    this.treeMain.Nodes.Remove(this.treeMain.SelectedNode);
                }
                else
                {
                    this.treeMain.SelectedNode.Parent.Nodes.Remove(this.treeMain.SelectedNode);
                }
            }
        }

        public void SelectAll()
        {
        }

        public bool CloseTab()
        {
            this.Hide();
            return true;
        }

        public void MarkAll(System.Text.RegularExpressions.Regex reg)
        {
        }

        public bool FindNext(System.Text.RegularExpressions.Regex reg, bool searchUp)
        {
            return false;
        }

        public void ReplaceNext(System.Text.RegularExpressions.Regex reg, string replaceWith, bool searchUp)
        {
        }

        public void ReplaceAll(System.Text.RegularExpressions.Regex reg, string replaceWith)
        {
        }

        public void SelectWord(int line, int offset, int wordLeng)
        {
        }

        public IPeterPluginHost Host
        {
            get { return this.m_Host; }

            set { this.m_Host = value; }
        }

        public string FileName
        {
            get { return ""; }
        }

        public string Selection
        {
            get { return ""; }
        }

        public bool AbleToUndo
        {
            get { return false; }
        }

        public bool AbleToRedo
        {
            get { return false; }
        }

        public bool AbleToPaste
        {
            get { return false; }
        }

        public bool AbleToCut
        {
            get { return false; }
        }

        public bool AbleToCopy
        {
            get { return true; }
        }

        public bool AbleToSelectAll
        {
            get { return false; }
        }

        public bool AbleToSave
        {
            get { return false; }
        }

        public bool AbleToDelete
        {
            get { return true; }
        }

        public bool NeedsSaving
        {
            get { return false; }
        }

        #endregion
    }
}